﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace NoteHelper
{
    public class PopupMenu : SourceGrid.Cells.Controllers.ControllerBase
    {
        ContextMenu menu = new ContextMenu();
        public PopupMenu()
        {
        }

        public void AddMenuItems(string caption, EventHandler onClick)
        {
            menu.MenuItems.Add(caption, onClick);
        }

        public override void OnMouseUp(SourceGrid.CellContext sender, MouseEventArgs e)
        {
            base.OnMouseUp(sender, e);

            if (e.Button == MouseButtons.Right)
                menu.Show(sender.Grid, new Point(e.X, e.Y));
        }
    }
}
